Xbasic

XBASIC_WAIT_FOR_IDLE Function

Syntax

V XBASIC_WAIT_FOR_IDLE([N wait_time])

Arguments

wait_timeNumeric

The number of seconds to wait. Numeric

Description

Run current script asynchronously (after call) and wait for an idle.

Discussion

The XBASIC_WAIT_FOR_IDLE() function causes the script to wait for other Alpha Anywhere processes and screen refreshes to complete before proceeding.

The function forces each action to complete before the next action starts. If code is written that requires one action to complete before the next begins, then the XBASIC_WAIT_FOR_IDLE() would be appropriate. An example is a succession of operations where the result of one operation, such as an append, must be completed before an update operation.

' start process
Xbasic_wait_for_idle()
' start another process

XBASIC_WAIT_FOR_IDLE() waits for the main loop to idle. The main loop is the entire Alpha Anywhere application. For example, if there are any messages that need to be processed (such as a screen repaint), the Xbasic script will wait until those messages have been processed. So for example, this will allow a screen repaint, a focus change, initializing of menus and toolbars on a form open, etc. to happen before your Xbasic script continues.

UI_YIELD() is similar to XBASIC_WAIT_FOR_IDLE(), but only allows pending screen repaints to happen. It does not allow other messages (such as form activate, deactivate, change of focus etc) in the message queue to happen.

Limitations

Desktop applications only.

See Also